package com.ruoyi.carwash.service.impl;

import com.ruoyi.carwash.domain.Order;
import com.ruoyi.carwash.mapper.OrderMapper;
import com.ruoyi.carwash.service.OrderService;
import com.ruoyi.carwash.vo.OrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;


    @Override
    public List<OrderVo> selectOrderList(OrderVo order) {
        return orderMapper.selectOrderList(order);
    }

    @Override
    public Order getOrderDetail(Long id) {
        return orderMapper.selectOrderById(id);
    }

    @Override
    @Transactional
    public void updateOrderStatus(Long id, Integer status) {
        orderMapper.updateOrderStatus(id, status);
    }

    @Override
    @Transactional
    public void updatePaymentStatus(Long id, Integer paymentStatus, String paymentTransactionId) {
        orderMapper.updatePaymentStatus(id, paymentStatus, LocalDateTime.now(), paymentTransactionId);
    }
} 